require(['./config'], function() {
    require(['swiper', 'template', 'loadHAF'], function(Swiper, template) {
        class Home {

            constructor() {
                this.initCarousel()
                this.initProductListF()
                this.initProductListS()
                this.initProductListT()
                this.initProductListFouth()
                this.initProductListfirth()
                this.initProductListsixth()
                this.initProductListseventh()
            }

            initCarousel() {
                const
                    mySwiper = new Swiper('.swiper-container', {
                        slidesRewView: 1,
                        spaceBetween: 0,
                        loop: true,
                        autoplay: {
                            delay: 2000,
                        },
                        pagination: {
                            el: '.swiper-pagination',
                            clickable: true,
                        }

                    })


            }
            initProductListF() {
                const url = "http://www.xiongmaoyouxuan.com/api/search?word=%E9%AD%85%E6%97%8F%E6%89%8B%E6%9C%BA"
                $.getJSON(url, function(resp) {
                    const list = resp.data.list
                    const data = { products: list }
                    const html = template('firstList', data)
                    $(".prod_list").html(html)
                })
            }
            initProductListS() {
                const url = "http://www.xiongmaoyouxuan.com/api/search?word=%E9%AD%85%E6%97%8F%E8%80%B3%E6%9C%BA"
                $.getJSON(url, function(resp) {
                    const list = resp.data.list
                    const data = { products: list }
                    const html = template('secondList', data)
                    $(".meizuLisen_list").html(html)
                })
            }
            initProductListT() {
                const url = "http://www.xiongmaoyouxuan.com/api/search?word=%E6%89%8B%E6%9C%BA%E9%85%8D%E4%BB%B6&start=0&sort=0&couponOnly=0&minPrice=80"
                $.getJSON(url, function(resp) {
                    const list = resp.data.list
                    const data = { products: list }
                    const html = template('secondList', data)
                    $(".meizuMountings_list").html(html)
                })
            }
            initProductListFouth() {
                const url = "http://www.xiongmaoyouxuan.com/api/search?word=%E6%89%8B%E6%9C%BA%E5%91%A8%E8%BE%B9&start=0&sort=0&couponOnly=0&minPrice=80&maxPrice=99999"
                $.getJSON(url, function(resp) {
                    const list = resp.data.list
                    const data = { products: list }
                    const html = template('secondList', data)
                    $(".meizuLife_list").html(html)
                })
            }
            initProductListfirth() {
                const url = "http://rap2api.taobao.org/app/mock/177503/126/1212"
                $.getJSON(url, function(resp) {
                    const list = resp.date.list
                    const data = { products: list }
                    const html = template('thirdList', data)
                    $(".community_list").html(html)
                })
            }
            initProductListsixth() {
                const url = "http://rap2api.taobao.org/app/mock/177503/api/545"
                $.getJSON(url, function(resp) {
                    const list = resp.date.list
                    const data = { products: list }
                    const html = template('fouthList', data)
                    $(".flyMe_list").html(html)
                })
            }
            initProductListseventh() {
                const url = "http://rap2api.taobao.org/app/mock/177503/api/545"
                $.getJSON(url, function(resp) {
                    const list = resp.date.list
                    const data = { products: list }
                    const html = template('fouthList', data)
                    $(".Live_list").html(html)
                })
            }
        }
        new Home()
    })
})